package cn.xxi.ai.application.dto;

import cn.xxi.ai.application.entity.MessageData;
import lombok.Getter;

import java.time.LocalDateTime;

@Getter
public abstract class StartedEvent<O> extends MessageData {

    /** 开始时间 */
    protected final LocalDateTime startedAt;

    public StartedEvent() {
        this.startedAt = LocalDateTime.now();
    }

    @Override
    public boolean persistent() {
        return true;
    }

    public abstract FinishedEvent toSuccessEvent(O outputs);

    public abstract FinishedEvent toFailureEvent(String error);
}
